package com.bracketbird.server.services;


import com.bracketbird.client.service.rtc.*;
import com.bracketbird.server.dao.*;
import com.bracketbird.server.repository.tournament.*;
import com.bracketbird.clientcore.appcontrol.*;

/**
 *
 */
public class RTCActionHandler extends AbstractActionHandler implements ActionHandler<RTCAction, RTCResult> {


    public RTCResult execute(RTCAction action) throws ApplicationException {

        TournamentRepository repos = new TournamentRepository();

        try {

            PMF.startTransaction();

            RTCResponse response = repos.updateTournament(action.getRequest());

            PMF.commitTransaction();

            return new RTCResult(response);
        }
        finally {
            PMF.endTransaction();
        }
    }

    public Class<RTCAction> getActionType() {
        return RTCAction.class;
    }


}